﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace game
{
    public class Pool<T>
    {
        Stack<T> list;

        public Pool()
        {
            list = new Stack<T>();
        }

        public int Count { get { return list.Count; } }

        public T Get()
        {
            if(list.Count <= 0)
                return default(T);
            return list.Pop();
        }

        public void Put(T element)
        {
            list.Push(element);
        }
    }
}
